import 'package:daoyi_ui_admin_getx/app/modules/tabs/tabs_controller.dart';
import 'package:daoyi_ui_admin_getx/app/routes/app_pages.dart';
import 'package:daoyi_ui_admin_getx/generated/locales.g.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class PageContent extends StatelessWidget {
  final String name;

  const PageContent({super.key, required this.name});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("${LocaleKeys.commons_current_page.tr}：$name"),
        centerTitle: true,
      ),
      body: SafeArea(
        child: ListView(
          children: <Widget>[
            ElevatedButton(
              onPressed: () {
                Get.updateLocale(const Locale('zh', 'CN'));
                Get.find<TabsController>().update([const Key("bottomNavigationBar")]);
              },
              child: const Text("简体中文"),
            ),
            ElevatedButton(
              onPressed: () {
                Get.updateLocale(const Locale('en', 'US'));
                Get.find<TabsController>().update([const Key("bottomNavigationBar")]);
              },
              child: const Text("English"),
            ),
            ElevatedButton(
              onPressed: () {
                Get.toNamed(Routes.HOME);
              },
              child: const Text(Routes.HOME),
            ),
            ElevatedButton(
              onPressed: () {
                Get.offAllNamed(Routes.LOGIN);
              },
              child: const Text(Routes.LOGIN),
            ),
            ElevatedButton(
              onPressed: () {
                Get.toNamed('/4041sadds');
              },
              child: const Text('404'),
            ),
            ElevatedButton(
              onPressed: () {
                Get.toNamed('/room-detail/222');
              },
              child: const Text(Routes.ROOM_DETAIL),
            ),
            ElevatedButton(
              onPressed: () {
                Get.snackbar("title", "message", colorText: Colors.white);
              },
              child: const Text("显示snackbar"),
            ),
          ],
        ),
      ),
    );
  }
}
